#ifndef PSD_IO_UDT_H
#define PSD_IO_UDT_H

#include <sys/socket.h>
#include <pthread.h>

#include "psd_conn.h"
#include "udt_c_wrapper.h"

typedef struct psd_udt_header_t {
	uint8_t type;
	uint32_t args;
} psdUdtHeader;

#define UDT_TYPE_DATA	1
#define UDT_TYPE_CLOSE	2

typedef struct psd_connection_udt_data_t {
	pthread_mutex_t lock;
	int closed;
	UDTSOCKET sd;
	int read_closed;
	int write_closed;
	uint32_t left_to_read;
	psdUdtHeader *hdr_bufs;
	int hdr_bufs_head;
} psdConn_udtData;

psdConn *psd_conn_udt_alloc(UDTSOCKET sd);

#endif
